home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Daemon
/
OldPatch
/
BAckdrop.cOLD
next >
Wrap
Text File
|
1998-06-27
|
5KB
|
180 lines
#include "MP.h"
//#include "MPobject.h"
#include <proto/datatypes.h>
#include <datatypes/datatypesclass.h>
#include <datatypes/datatypes.h>
#include <datatypes/pictureclass.h>
#include "imagebackfill.h"
#define MPHOOK_OK 0
#define MPHOOK_WARN 1
#define MPHOOK_FAIL 2
extern BOOL V39;
void FreeBackdrop(struct Backdrop *B);
struct Backdrop
{
struct Node bd_Node;
struct Screen *bd_Screen;
struct Window *bd_Window;
BOOL bd_Loaded;
struct BackFillOptions bd_BFOptions;
struct BackFillInfo bd_BFInfo;
};
struct List BackdropList;
LONG AddBackdrop(struct Screen *Scr, struct DefaultNode *DN)
{
struct Backdrop *b;
// ULONG dtwidth,dtheight,dtw,dth,swidth,sheight,wleft,wtop,gid;
// struct FrameInfo *fi;
if(Scr && DN && V39)
{
if((DN->BackdropFlags & BF_ON) && DN->BackdropFile && DataTypesBase)
{
if(b=AllocVec(sizeof(struct Backdrop),MEMF_CLEAR|MEMF_PUBLIC))
{
b->bd_Screen=Scr;
b->bd_BFOptions.MaxCopyWidth=
b->bd_BFOptions.MaxCopyWidth=320;
b->bd_BFOptions.CenterX=
b->bd_BFOptions.CenterY=(DN->BackdropFlags & BF_CENTER);
b->bd_BFOptions.OffsetX=0;
b->bd_BFOptions.OffsetY=0;
b->bd_BFOptions.OffsetTitleY=0;
if(LoadBackgroundImage(&b->bd_BFInfo,DN->BackdropFile,Scr,&b->bd_BFOptions))
{
b->bd_Loaded=1;
if(b->bd_Window=OpenWindowTags(0,WA_CustomScreen, Scr,
WA_Left ,0,
WA_Top ,0,
WA_Width ,Scr->Width,
WA_Height ,Scr->Height,
WA_Flags ,WFLG_BACKDROP|WFLG_BORDERLESS|WFLG_SIMPLE_REFRESH|WFLG_NOCAREREFRESH,
WA_CustomScreen,Scr,
WA_BackFill ,&b->bd_BFInfo,
/* WA_Top , wtop,
WA_Left , wleft,
WA_Width , dtwidth,
WA_Height , dtheight,
WA_AutoAdjust , 1,
// WA_Backdrop , 1,
// WA_Borderless , 0,
WA_SimpleRefresh,1,*/
TAG_DONE))
{
AddHead(&BackdropList,(struct Node *)b);
// AddDTObject(b->bd_Window,0,b->bd_DTObject,-1);
// RefreshDTObjectA(b->bd_DTObject,b->bd_Window,0,0);
return(MPHOOK_OK);
}
}
FreeBackdrop(b);
}
}
}
}
void RemoveBackdrop(struct Screen *Scr)
{
struct Backdrop *b;
b=(struct Backdrop *)BackdropList.lh_Head;
while(b->bd_Node.ln_Succ)
{
if(b->bd_Screen==Scr)
{
struct Backdrop *b2;
b2=(struct Backdrop *)b->bd_Node.ln_Succ;
Remove((struct Node *)b);
FreeBackdrop(b);
b=b2;
}
else
{
b=(struct Backdrop *)b->bd_Node.ln_Succ;
}
}
}
void FreeBackdrop(struct Backdrop *B)
{
if(B)
{
if(B->bd_Loaded)
{
if(B->bd_Window)
{
CloseWindow(B->bd_Window);
}
UnloadBackgroundImage(&B->bd_BFInfo);
}
FreeVec(B);
}
}
/*
if(b->bd_DTObject=NewDTObject(DN->BackdropFile,
DTA_GroupID, GID_PICTURE,
DTA_SourceType, DTST_FILE,
DTA_Immediate, 1,
//PDTA_Remap ,TRUE,
//PDTA_Screen ,Scr,
DTA_TextAttr, Scr->Font,
GA_ID, b,
TAG_DONE))
{
swidth=dtwidth =Scr->Width;
sheight=dtheight =Scr->Height-Scr->BarHeight+Scr->BarVBorder;
GetDTAttrs(b->bd_DTObject, DTA_NominalHoriz, &dtwidth,
DTA_NominalVert, &dtheight,
DTA_GroupID, &gid,
DTA_FrameInfo, &fi,
TAG_DONE);
dtwidth=fi->fri_Dimensions.Width;
dtheight=fi->fri_Dimensions.Height;
dtwidth =min(swidth,dtwidth);
dtheight=min(sheight,dtheight);
dtwidth =max(50,dtwidth);
dtheight=max(50,dtheight);
wleft =(swidth-dtwidth)/2;
wleft =max(0,wleft);
wtop =(sheight-dtheight)/2;
wtop =max(0,wtop);
SetDTAttrs(b->bd_DTObject, 0,0,
GA_Width, dtwidth,
GA_Height, dtheight,
TAG_DONE);
*/